{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "zvMMnXDiH7U5"
      },
      "source": [
        "# Screenplay Write Agents\n",
        "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/MervinPraison/PraisonAI/blob/main/cookbooks/notebooks/screenplay_writer_agents.ipynb)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "BUtAfnnwH7U6"
      },
      "source": [
        "## Dependencies"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "id": "zmweEwqsH7U6"
      },
      "outputs": [],
      "source": [
        "# Install dependencies without output\n",
        "%pip install langchain_community > /dev/null\n",
        "%pip install praisonai[crewai] > /dev/null\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "j3ckhi4SH7U6"
      },
      "source": [
        "## Tools"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 32,
      "metadata": {
        "id": "W4pubD8FH7U6"
      },
      "outputs": [],
      "source": [
        "# This workflow does not utilize any tool"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "5En-K8HZH7U6"
      },
      "source": [
        "## YAML Prompt"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 35,
      "metadata": {
        "id": "7CuZDDZmH7U6"
      },
      "outputs": [],
      "source": [
        "agent_yaml = \"\"\"\n",
        "framework: \"crewai\"\n",
        "topic: \"Newsgroup Post Processing and Formatting\"\n",
        "roles:\n",
        "  spamfilter:\n",
        "    role: \"Spam Filter\"\n",
        "    backstory: |\n",
        "      You are an expert spam filter with years of experience. You DETEST advertisements, newsletters, and vulgar language.\n",
        "    goal: \"Decide whether a text is spam or not.\"\n",
        "    tasks:\n",
        "      filter_spam:\n",
        "        description: |\n",
        "          Read the following newsgroup post. If this contains vulgar language or is spam, reply with \"STOP\".\n",
        "          Otherwise, let it pass for further processing.\n",
        "        expected_output: \"Either 'STOP' if the post contains vulgar language or is spam, or no response if it does not.\"\n",
        "    tools: []\n",
        "  analyst:\n",
        "    role: \"Discussion Analyst\"\n",
        "    backstory: |\n",
        "      An expert in analyzing discussions, with a keen ability to distill arguments and identify who said what.\n",
        "      Able to rephrase content while maintaining the core points of the discussion.\n",
        "    goal: \"Distill all arguments from the discussion members, identifying who said what.\"\n",
        "    tasks:\n",
        "      analyze_discussion:\n",
        "        description: |\n",
        "          Analyze in detail the following discussion, identifying who said what and rewording if necessary, while maintaining the main discussion points.\n",
        "        expected_output: \"A detailed analysis of the discussion, identifying who said what and rewording as needed.\"\n",
        "    tools: []\n",
        "  scriptwriter:\n",
        "    role: \"Script Writer\"\n",
        "    backstory: |\n",
        "      An expert in transforming conversations into movie script dialogues with a focus on natural dialogue,\n",
        "      avoiding situational descriptions, actions, or parentheticals.\n",
        "    goal: \"Turn a conversation into a movie script with only dialogue.\"\n",
        "    tasks:\n",
        "      create_script:\n",
        "        description: |\n",
        "          Create a dialogue-heavy screenplay from the discussion, formatted as a conversation between two persons.\n",
        "          Do NOT write parentheticals, wrylies, or directional notes.\n",
        "        expected_output: \"A screenplay dialogue with only the conversation parts, without parentheticals or directional notes.\"\n",
        "    tools: []\n",
        "  formatter:\n",
        "    role: \"Text Formatter\"\n",
        "    backstory: |\n",
        "      A formatting expert skilled at ensuring text meets specified structure and style requirements,\n",
        "      particularly removing extraneous information such as actions or directions within brackets.\n",
        "    goal: \"Format text according to specified style, leaving out actions within brackets.\"\n",
        "    tasks:\n",
        "      format_script:\n",
        "        description: |\n",
        "          Format the script exactly like this:\n",
        "            ## (person 1):\n",
        "            (first text line from person 1)\n",
        "\n",
        "            ## (person 2):\n",
        "            (first text line from person 2)\n",
        "\n",
        "            ## (person 1):\n",
        "            (second text line from person 1)\n",
        "\n",
        "            ## (person 2):\n",
        "            (second text line from person 2)\n",
        "        expected_output: \"A formatted script with the specified structure, ensuring each line is formatted according to the provided template.\"\n",
        "    tools: []\n",
        "  scorer:\n",
        "    role: \"Dialogue Scorer\"\n",
        "    backstory: |\n",
        "      A dialogue scoring expert with a keen eye for clarity, engagement, and coherence, skilled at assessing the quality of a conversation.\n",
        "    goal: \"Score a dialogue on various aspects including clarity, conciseness, engagement, and relevance.\"\n",
        "    tasks:\n",
        "      score_dialogue:\n",
        "        description: |\n",
        "          Score the following script based on clarity, relevance, conciseness, politeness, engagement, flow, coherence, responsiveness, language use, and emotional intelligence.\n",
        "          Use a scale from 1 to 10, where 1 is the lowest performance and 10 is the highest.\n",
        "        expected_output: \"The Entire Screenplay along with a score from 1 to 10, indicating how well the script achieves clarity, coherence, and engagement.\"\n",
        "    tools: []\n",
        "dependencies: []\n",
        "\"\"\""
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "ukuRiMZdH7U7"
      },
      "source": [
        "## Main"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 36,
      "metadata": {
        "id": "Mtwl6CxtH7U7",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "outputId": "f5fc01da-cd8d-4fce-cc39-300b9e81f61c"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "\u001b[1m\u001b[95m [2024-11-04 05:16:21][DEBUG]: == Working Agent: Spam Filter\u001b[00m\n",
            "\u001b[1m\u001b[95m [2024-11-04 05:16:21][INFO]: == Starting Task: Read the following newsgroup post. If this contains vulgar language or is spam, reply with \"STOP\". \n",
            "Otherwise, let it pass for further processing.\n",
            "\u001b[00m\n",
            "\n",
            "\n",
            "\u001b[1m> Entering new CrewAgentExecutor chain...\u001b[0m\n",
            "\u001b[32;1m\u001b[1;3mI now can give a great answer  \n",
            "Final Answer: STOP\u001b[0m\n",
            "\n",
            "\u001b[1m> Finished chain.\u001b[0m\n",
            "\u001b[1m\u001b[92m [2024-11-04 05:16:21][DEBUG]: == [Spam Filter] Task output: STOP\n",
            "\n",
            "\u001b[00m\n",
            "\u001b[1m\u001b[95m [2024-11-04 05:16:21][DEBUG]: == Working Agent: Discussion Analyst\u001b[00m\n",
            "\u001b[1m\u001b[95m [2024-11-04 05:16:21][INFO]: == Starting Task: Analyze in detail the following discussion, identifying who said what and rewording if necessary, while maintaining the main discussion points.\n",
            "\u001b[00m\n",
            "\n",
            "\n",
            "\u001b[1m> Entering new CrewAgentExecutor chain...\u001b[0m\n",
            "\u001b[32;1m\u001b[1;3mI now can give a great answer  \n",
            "Final Answer: \n",
            "\n",
            "In the discussion, several key points were raised by the participants, each contributing their perspectives on the topic at hand.\n",
            "\n",
            "1. **Participant A** opened the conversation by stating, \"We need to consider the impact of our decisions on the environment.\" This highlights the importance of sustainability in decision-making processes.\n",
            "\n",
            "2. **Participant B** responded by emphasizing, \"While environmental concerns are vital, we must also address the economic implications.\" This indicates a dual focus on both ecological and economic factors, suggesting that a balance is required.\n",
            "\n",
            "3. **Participant C** then interjected with, \"Perhaps we can find a solution that benefits both the economy and the environment.\" This presents the idea of a synergistic approach, fostering collaboration between the two areas of concern.\n",
            "\n",
            "4. **Participant A** reiterated, \"Collaboration is crucial, but we should prioritize long-term environmental health over short-term economic gains.\" This reinforces the stance that sustainability should take precedence in the decision-making hierarchy.\n",
            "\n",
            "5. **Participant D** added, \"It's essential to involve local communities in this process, as they are directly affected by our decisions.\" This point underscores the need for inclusivity and community engagement in discussions about environmental and economic policies.\n",
            "\n",
            "6. **Participant B** countered, \"Involving local communities is important, but we must ensure that their voices are heard equally among stakeholders.\" This stresses the necessity of equitable representation among all parties involved.\n",
            "\n",
            "7. **Participant C** concluded by suggesting, \"We should create a framework that integrates stakeholder feedback while focusing on both economic growth and environmental stewardship.\" This encapsulates a comprehensive approach to addressing the concerns raised throughout the discussion.\n",
            "\n",
            "Overall, the discussion revealed a multifaceted perspective on the interplay between environmental sustainability and economic development, with participants advocating for collaboration, community involvement, and a balanced approach to decision-making.\u001b[0m\n",
            "\n",
            "\u001b[1m> Finished chain.\u001b[0m\n",
            "\u001b[1m\u001b[92m [2024-11-04 05:16:26][DEBUG]: == [Discussion Analyst] Task output: In the discussion, several key points were raised by the participants, each contributing their perspectives on the topic at hand.\n",
            "\n",
            "1. **Participant A** opened the conversation by stating, \"We need to consider the impact of our decisions on the environment.\" This highlights the importance of sustainability in decision-making processes.\n",
            "\n",
            "2. **Participant B** responded by emphasizing, \"While environmental concerns are vital, we must also address the economic implications.\" This indicates a dual focus on both ecological and economic factors, suggesting that a balance is required.\n",
            "\n",
            "3. **Participant C** then interjected with, \"Perhaps we can find a solution that benefits both the economy and the environment.\" This presents the idea of a synergistic approach, fostering collaboration between the two areas of concern.\n",
            "\n",
            "4. **Participant A** reiterated, \"Collaboration is crucial, but we should prioritize long-term environmental health over short-term economic gains.\" This reinforces the stance that sustainability should take precedence in the decision-making hierarchy.\n",
            "\n",
            "5. **Participant D** added, \"It's essential to involve local communities in this process, as they are directly affected by our decisions.\" This point underscores the need for inclusivity and community engagement in discussions about environmental and economic policies.\n",
            "\n",
            "6. **Participant B** countered, \"Involving local communities is important, but we must ensure that their voices are heard equally among stakeholders.\" This stresses the necessity of equitable representation among all parties involved.\n",
            "\n",
            "7. **Participant C** concluded by suggesting, \"We should create a framework that integrates stakeholder feedback while focusing on both economic growth and environmental stewardship.\" This encapsulates a comprehensive approach to addressing the concerns raised throughout the discussion.\n",
            "\n",
            "Overall, the discussion revealed a multifaceted perspective on the interplay between environmental sustainability and economic development, with participants advocating for collaboration, community involvement, and a balanced approach to decision-making.\n",
            "\n",
            "\u001b[00m\n",
            "\u001b[1m\u001b[95m [2024-11-04 05:16:26][DEBUG]: == Working Agent: Script Writer\u001b[00m\n",
            "\u001b[1m\u001b[95m [2024-11-04 05:16:26][INFO]: == Starting Task: Create a dialogue-heavy screenplay from the discussion, formatted as a conversation between two persons.\n",
            "Do NOT write parentheticals, wrylies, or directional notes.\n",
            "\u001b[00m\n",
            "\n",
            "\n",
            "\u001b[1m> Entering new CrewAgentExecutor chain...\u001b[0m\n",
            "\u001b[32;1m\u001b[1;3mI now can give a great answer  \n",
            "Final Answer:  \n",
            "We need to consider the impact of our decisions on the environment.  \n",
            "While environmental concerns are vital, we must also address the economic implications.  \n",
            "Perhaps we can find a solution that benefits both the economy and the environment.  \n",
            "Collaboration is crucial, but we should prioritize long-term environmental health over short-term economic gains.  \n",
            "It's essential to involve local communities in this process, as they are directly affected by our decisions.  \n",
            "Involving local communities is important, but we must ensure that their voices are heard equally among stakeholders.  \n",
            "We should create a framework that integrates stakeholder feedback while focusing on both economic growth and environmental stewardship.  \u001b[0m\n",
            "\n",
            "\u001b[1m> Finished chain.\u001b[0m\n",
            "\u001b[1m\u001b[92m [2024-11-04 05:16:28][DEBUG]: == [Script Writer] Task output: We need to consider the impact of our decisions on the environment.  \n",
            "While environmental concerns are vital, we must also address the economic implications.  \n",
            "Perhaps we can find a solution that benefits both the economy and the environment.  \n",
            "Collaboration is crucial, but we should prioritize long-term environmental health over short-term economic gains.  \n",
            "It's essential to involve local communities in this process, as they are directly affected by our decisions.  \n",
            "Involving local communities is important, but we must ensure that their voices are heard equally among stakeholders.  \n",
            "We should create a framework that integrates stakeholder feedback while focusing on both economic growth and environmental stewardship.\n",
            "\n",
            "\u001b[00m\n",
            "\u001b[1m\u001b[95m [2024-11-04 05:16:28][DEBUG]: == Working Agent: Text Formatter\u001b[00m\n",
            "\u001b[1m\u001b[95m [2024-11-04 05:16:28][INFO]: == Starting Task: Format the script exactly like this:\n",
            "  ## (person 1):\n",
            "  (first text line from person 1)\n",
            "\n",
            "  ## (person 2):\n",
            "  (first text line from person 2)\n",
            "  \n",
            "  ## (person 1):\n",
            "  (second text line from person 1)\n",
            "  \n",
            "  ## (person 2):\n",
            "  (second text line from person 2)\n",
            "\u001b[00m\n",
            "\n",
            "\n",
            "\u001b[1m> Entering new CrewAgentExecutor chain...\u001b[0m\n",
            "\u001b[32;1m\u001b[1;3mI now can give a great answer  \n",
            "Final Answer:  \n",
            "## Person 1:  \n",
            "We need to consider the impact of our decisions on the environment.  \n",
            "\n",
            "## Person 2:  \n",
            "While environmental concerns are vital, we must also address the economic implications.  \n",
            "\n",
            "## Person 1:  \n",
            "Perhaps we can find a solution that benefits both the economy and the environment.  \n",
            "\n",
            "## Person 2:  \n",
            "Collaboration is crucial, but we should prioritize long-term environmental health over short-term economic gains.  \n",
            "\n",
            "## Person 1:  \n",
            "It's essential to involve local communities in this process, as they are directly affected by our decisions.  \n",
            "\n",
            "## Person 2:  \n",
            "Involving local communities is important, but we must ensure that their voices are heard equally among stakeholders.  \n",
            "\n",
            "## Person 1:  \n",
            "We should create a framework that integrates stakeholder feedback while focusing on both economic growth and environmental stewardship.\u001b[0m\n",
            "\n",
            "\u001b[1m> Finished chain.\u001b[0m\n",
            "\u001b[1m\u001b[92m [2024-11-04 05:16:31][DEBUG]: == [Text Formatter] Task output: ## Person 1:  \n",
            "We need to consider the impact of our decisions on the environment.  \n",
            "\n",
            "## Person 2:  \n",
            "While environmental concerns are vital, we must also address the economic implications.  \n",
            "\n",
            "## Person 1:  \n",
            "Perhaps we can find a solution that benefits both the economy and the environment.  \n",
            "\n",
            "## Person 2:  \n",
            "Collaboration is crucial, but we should prioritize long-term environmental health over short-term economic gains.  \n",
            "\n",
            "## Person 1:  \n",
            "It's essential to involve local communities in this process, as they are directly affected by our decisions.  \n",
            "\n",
            "## Person 2:  \n",
            "Involving local communities is important, but we must ensure that their voices are heard equally among stakeholders.  \n",
            "\n",
            "## Person 1:  \n",
            "We should create a framework that integrates stakeholder feedback while focusing on both economic growth and environmental stewardship.\n",
            "\n",
            "\u001b[00m\n",
            "\u001b[1m\u001b[95m [2024-11-04 05:16:31][DEBUG]: == Working Agent: Dialogue Scorer\u001b[00m\n",
            "\u001b[1m\u001b[95m [2024-11-04 05:16:31][INFO]: == Starting Task: Score the following script based on clarity, relevance, conciseness, politeness, engagement, flow, coherence, responsiveness, language use, and emotional intelligence.\n",
            "Use a scale from 1 to 10, where 1 is the lowest performance and 10 is the highest.\n",
            "\u001b[00m\n",
            "\n",
            "\n",
            "\u001b[1m> Entering new CrewAgentExecutor chain...\u001b[0m\n",
            "\u001b[32;1m\u001b[1;3mI now can give a great answer  \n",
            "Final Answer: \n",
            "\n",
            "**Dialogue Script:**\n",
            "\n",
            "## Person 1:  \n",
            "We need to consider the impact of our decisions on the environment.  \n",
            "\n",
            "## Person 2:  \n",
            "While environmental concerns are vital, we must also address the economic implications.  \n",
            "\n",
            "## Person 1:  \n",
            "Perhaps we can find a solution that benefits both the economy and the environment.  \n",
            "\n",
            "## Person 2:  \n",
            "Collaboration is crucial, but we should prioritize long-term environmental health over short-term economic gains.  \n",
            "\n",
            "## Person 1:  \n",
            "It's essential to involve local communities in this process, as they are directly affected by our decisions.  \n",
            "\n",
            "## Person 2:  \n",
            "Involving local communities is important, but we must ensure that their voices are heard equally among stakeholders.  \n",
            "\n",
            "## Person 1:  \n",
            "We should create a framework that integrates stakeholder feedback while focusing on both economic growth and environmental stewardship.\n",
            "\n",
            "**Score Breakdown:**\n",
            "\n",
            "- **Clarity:** 9  \n",
            "  The dialogue is clear, with each person articulating their thoughts effectively, making it easy for the audience to follow.\n",
            "\n",
            "- **Relevance:** 10  \n",
            "  All statements are relevant to the topic of balancing environmental and economic considerations.\n",
            "\n",
            "- **Conciseness:** 8  \n",
            "  The dialogue is mostly concise; however, some statements could be slightly more streamlined without losing meaning.\n",
            "\n",
            "- **Politeness:** 9  \n",
            "  Both participants maintain a respectful tone throughout the conversation.\n",
            "\n",
            "- **Engagement:** 8  \n",
            "  The discussion is engaging, although it could benefit from more emotional appeal or personal anecdotes to enhance connection.\n",
            "\n",
            "- **Flow:** 9  \n",
            "  The dialogue flows smoothly, with each response building on the previous one.\n",
            "\n",
            "- **Coherence:** 9  \n",
            "  The conversation maintains coherence, with each point logically leading to the next.\n",
            "\n",
            "- **Responsiveness:** 9  \n",
            "  Each person responds directly to the other's points, indicating active listening and engagement.\n",
            "\n",
            "- **Language Use:** 9  \n",
            "  The language is appropriate for the topic, with no jargon that would confuse the audience.\n",
            "\n",
            "- **Emotional Intelligence:** 8  \n",
            "  While there is a good understanding of the importance of community involvement, the emotional nuances could be more pronounced.\n",
            "\n",
            "**Overall Score: 9/10**  \n",
            "The dialogue effectively balances clarity, coherence, and engagement, making it a strong conversation on the complex topic of environmental and economic considerations.\u001b[0m\n",
            "\n",
            "\u001b[1m> Finished chain.\u001b[0m\n",
            "\u001b[1m\u001b[92m [2024-11-04 05:16:36][DEBUG]: == [Dialogue Scorer] Task output: **Dialogue Script:**\n",
            "\n",
            "## Person 1:  \n",
            "We need to consider the impact of our decisions on the environment.  \n",
            "\n",
            "## Person 2:  \n",
            "While environmental concerns are vital, we must also address the economic implications.  \n",
            "\n",
            "## Person 1:  \n",
            "Perhaps we can find a solution that benefits both the economy and the environment.  \n",
            "\n",
            "## Person 2:  \n",
            "Collaboration is crucial, but we should prioritize long-term environmental health over short-term economic gains.  \n",
            "\n",
            "## Person 1:  \n",
            "It's essential to involve local communities in this process, as they are directly affected by our decisions.  \n",
            "\n",
            "## Person 2:  \n",
            "Involving local communities is important, but we must ensure that their voices are heard equally among stakeholders.  \n",
            "\n",
            "## Person 1:  \n",
            "We should create a framework that integrates stakeholder feedback while focusing on both economic growth and environmental stewardship.\n",
            "\n",
            "**Score Breakdown:**\n",
            "\n",
            "- **Clarity:** 9  \n",
            "  The dialogue is clear, with each person articulating their thoughts effectively, making it easy for the audience to follow.\n",
            "\n",
            "- **Relevance:** 10  \n",
            "  All statements are relevant to the topic of balancing environmental and economic considerations.\n",
            "\n",
            "- **Conciseness:** 8  \n",
            "  The dialogue is mostly concise; however, some statements could be slightly more streamlined without losing meaning.\n",
            "\n",
            "- **Politeness:** 9  \n",
            "  Both participants maintain a respectful tone throughout the conversation.\n",
            "\n",
            "- **Engagement:** 8  \n",
            "  The discussion is engaging, although it could benefit from more emotional appeal or personal anecdotes to enhance connection.\n",
            "\n",
            "- **Flow:** 9  \n",
            "  The dialogue flows smoothly, with each response building on the previous one.\n",
            "\n",
            "- **Coherence:** 9  \n",
            "  The conversation maintains coherence, with each point logically leading to the next.\n",
            "\n",
            "- **Responsiveness:** 9  \n",
            "  Each person responds directly to the other's points, indicating active listening and engagement.\n",
            "\n",
            "- **Language Use:** 9  \n",
            "  The language is appropriate for the topic, with no jargon that would confuse the audience.\n",
            "\n",
            "- **Emotional Intelligence:** 8  \n",
            "  While there is a good understanding of the importance of community involvement, the emotional nuances could be more pronounced.\n",
            "\n",
            "**Overall Score: 9/10**  \n",
            "The dialogue effectively balances clarity, coherence, and engagement, making it a strong conversation on the complex topic of environmental and economic considerations.\n",
            "\n",
            "\u001b[00m\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "### Task Output ###\n",
              "**Dialogue Script:**\n",
              "\n",
              "## Person \u001b[1;36m1\u001b[0m:  \n",
              "We need to consider the impact of our decisions on the environment.  \n",
              "\n",
              "## Person \u001b[1;36m2\u001b[0m:  \n",
              "While environmental concerns are vital, we must also address the economic implications.  \n",
              "\n",
              "## Person \u001b[1;36m1\u001b[0m:  \n",
              "Perhaps we can find a solution that benefits both the economy and the environment.  \n",
              "\n",
              "## Person \u001b[1;36m2\u001b[0m:  \n",
              "Collaboration is crucial, but we should prioritize long-term environmental health over short-term economic gains.  \n",
              "\n",
              "## Person \u001b[1;36m1\u001b[0m:  \n",
              "It's essential to involve local communities in this process, as they are directly affected by our decisions.  \n",
              "\n",
              "## Person \u001b[1;36m2\u001b[0m:  \n",
              "Involving local communities is important, but we must ensure that their voices are heard equally among \n",
              "stakeholders.  \n",
              "\n",
              "## Person \u001b[1;36m1\u001b[0m:  \n",
              "We should create a framework that integrates stakeholder feedback while focusing on both economic growth and \n",
              "environmental stewardship.\n",
              "\n",
              "**Score Breakdown:**\n",
              "\n",
              "- **Clarity:** \u001b[1;36m9\u001b[0m  \n",
              "  The dialogue is clear, with each person articulating their thoughts effectively, making it easy for the audience \n",
              "to follow.\n",
              "\n",
              "- **Relevance:** \u001b[1;36m10\u001b[0m  \n",
              "  All statements are relevant to the topic of balancing environmental and economic considerations.\n",
              "\n",
              "- **Conciseness:** \u001b[1;36m8\u001b[0m  \n",
              "  The dialogue is mostly concise; however, some statements could be slightly more streamlined without losing \n",
              "meaning.\n",
              "\n",
              "- **Politeness:** \u001b[1;36m9\u001b[0m  \n",
              "  Both participants maintain a respectful tone throughout the conversation.\n",
              "\n",
              "- **Engagement:** \u001b[1;36m8\u001b[0m  \n",
              "  The discussion is engaging, although it could benefit from more emotional appeal or personal anecdotes to enhance\n",
              "connection.\n",
              "\n",
              "- **Flow:** \u001b[1;36m9\u001b[0m  \n",
              "  The dialogue flows smoothly, with each response building on the previous one.\n",
              "\n",
              "- **Coherence:** \u001b[1;36m9\u001b[0m  \n",
              "  The conversation maintains coherence, with each point logically leading to the next.\n",
              "\n",
              "- **Responsiveness:** \u001b[1;36m9\u001b[0m  \n",
              "  Each person responds directly to the other's points, indicating active listening and engagement.\n",
              "\n",
              "- **Language Use:** \u001b[1;36m9\u001b[0m  \n",
              "  The language is appropriate for the topic, with no jargon that would confuse the audience.\n",
              "\n",
              "- **Emotional Intelligence:** \u001b[1;36m8\u001b[0m  \n",
              "  While there is a good understanding of the importance of community involvement, the emotional nuances could be \n",
              "more pronounced.\n",
              "\n",
              "**Overall Score: \u001b[1;36m9\u001b[0m/\u001b[1;36m10\u001b[0m**  \n",
              "The dialogue effectively balances clarity, coherence, and engagement, making it a strong conversation on the \n",
              "complex topic of environmental and economic considerations.\n"
            ],
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">### Task Output ###\n",
              "**Dialogue Script:**\n",
              "\n",
              "## Person <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>:  \n",
              "We need to consider the impact of our decisions on the environment.  \n",
              "\n",
              "## Person <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2</span>:  \n",
              "While environmental concerns are vital, we must also address the economic implications.  \n",
              "\n",
              "## Person <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>:  \n",
              "Perhaps we can find a solution that benefits both the economy and the environment.  \n",
              "\n",
              "## Person <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2</span>:  \n",
              "Collaboration is crucial, but we should prioritize long-term environmental health over short-term economic gains.  \n",
              "\n",
              "## Person <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>:  \n",
              "It's essential to involve local communities in this process, as they are directly affected by our decisions.  \n",
              "\n",
              "## Person <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2</span>:  \n",
              "Involving local communities is important, but we must ensure that their voices are heard equally among \n",
              "stakeholders.  \n",
              "\n",
              "## Person <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>:  \n",
              "We should create a framework that integrates stakeholder feedback while focusing on both economic growth and \n",
              "environmental stewardship.\n",
              "\n",
              "**Score Breakdown:**\n",
              "\n",
              "- **Clarity:** <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">9</span>  \n",
              "  The dialogue is clear, with each person articulating their thoughts effectively, making it easy for the audience \n",
              "to follow.\n",
              "\n",
              "- **Relevance:** <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">10</span>  \n",
              "  All statements are relevant to the topic of balancing environmental and economic considerations.\n",
              "\n",
              "- **Conciseness:** <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span>  \n",
              "  The dialogue is mostly concise; however, some statements could be slightly more streamlined without losing \n",
              "meaning.\n",
              "\n",
              "- **Politeness:** <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">9</span>  \n",
              "  Both participants maintain a respectful tone throughout the conversation.\n",
              "\n",
              "- **Engagement:** <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span>  \n",
              "  The discussion is engaging, although it could benefit from more emotional appeal or personal anecdotes to enhance\n",
              "connection.\n",
              "\n",
              "- **Flow:** <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">9</span>  \n",
              "  The dialogue flows smoothly, with each response building on the previous one.\n",
              "\n",
              "- **Coherence:** <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">9</span>  \n",
              "  The conversation maintains coherence, with each point logically leading to the next.\n",
              "\n",
              "- **Responsiveness:** <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">9</span>  \n",
              "  Each person responds directly to the other's points, indicating active listening and engagement.\n",
              "\n",
              "- **Language Use:** <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">9</span>  \n",
              "  The language is appropriate for the topic, with no jargon that would confuse the audience.\n",
              "\n",
              "- **Emotional Intelligence:** <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span>  \n",
              "  While there is a good understanding of the importance of community involvement, the emotional nuances could be \n",
              "more pronounced.\n",
              "\n",
              "**Overall Score: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">9</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">10</span>**  \n",
              "The dialogue effectively balances clarity, coherence, and engagement, making it a strong conversation on the \n",
              "complex topic of environmental and economic considerations.\n",
              "</pre>\n"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "None\n"
          ]
        }
      ],
      "source": [
        "import os\n",
        "from praisonai import PraisonAI\n",
        "from google.colab import userdata\n",
        "\n",
        "# Create a PraisonAI instance with the agent_yaml content\n",
        "praisonai = PraisonAI(agent_yaml=agent_yaml, tools=[])\n",
        "\n",
        "# Add OPENAI_API_KEY Secrets to Google Colab on the Left Hand Side 🔑 or Enter Manually Below\n",
        "os.environ[\"OPENAI_API_KEY\"] = userdata.get('OPENAI_API_KEY') or \"ENTER OPENAI_API_KEY HERE\"\n",
        "os.environ[\"OPENAI_MODEL_NAME\"] = \"gpt-5-nano\"\n",
        "\n",
        "# Run PraisonAI\n",
        "result = praisonai.run()\n",
        "\n",
        "# Print the result\n",
        "print(result) # 10/10\n"
      ]
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "RIIUGHh5LafR"
      },
      "execution_count": null,
      "outputs": []
    }
  ],
  "metadata": {
    "language_info": {
      "name": "python"
    },
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}